package net.sxnic.jhitem.itemannex.action;

import java.io.File;

import net.sxnic.jhitem.itemannex.ItemAnnex;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description:  [一句话描述该类的功能]
 * @Author [姓名] [联系方式]
 * @CreateDate:
 * @UpdateDate:   
 * @Version 1.0
 */
 
public class Delete extends ItemAnnexAction{
	private static final long serialVersionUID = 1L;

	private static Logger logger = LoggerFactory.getLogger(Delete.class);
	
	private String annexId;
	//文件类别
	private String fileSort;
	public String execute() throws Exception {
		//获取附件实体
		ItemAnnex itemAnnex = itemAnnexManager.get(annexId);
		//删除附件实体
		itemAnnexManager.delete(itemAnnex);
		File file = new File(itemAnnex.getFilePath()+itemAnnex.getFileName());
		//删除附件
		if(file.exists())
		{
			file.delete();
		}
		msg = "deleteSuccess";
		// 返回指定JSP
		return SUCCESS;
	}
	public String getAnnexId() {
		return annexId;
	}
	public void setAnnexId(String annexId) {
		this.annexId = annexId;
	}
	public String getFileSort() {
		return fileSort;
	}
	public void setFileSort(String fileSort) {
		this.fileSort = fileSort;
	}

}
